package cn.hdu.liang.arrays;

import java.util.Arrays;

class ArrVal {
    String name;
    int age;

    public ArrVal(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "ArrVal{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}

public class Exam18 {
    public static void main(String[] args) {
        ArrVal[] av = new ArrVal[4];
        ArrVal[] bv = new ArrVal[6];
        Arrays.fill(av, new ArrVal("liang", 10));
        Arrays.fill(bv, new ArrVal("hui", 20));
        System.out.println(Arrays.toString(av));
        System.out.println(Arrays.toString(bv));

        System.arraycopy(av, 0, bv, 0, 2);
        System.out.println(Arrays.toString(bv));
        av[0].name = "小鱼";
        av[0].age = 3;
        System.out.println(Arrays.toString(bv));
    }
}
